using System.Collections.ObjectModel;
using HMCollada.Core;
using HMCollada.FX;
using System.Xml;

namespace HMCollada.FX {
    internal struct HMColladaLibraryEffects {
        internal string id;
        internal string name;
        internal HMColladaAsset asset;
        internal Collection<HMColladaEffect> effect;
    }
}
namespace HMCollada {
    internal partial class HMColladaLoader {
        internal static HMColladaLibraryEffects LoadLibraryEffects() {
            HMColladaLibraryEffects newLibraryEffects = new HMColladaLibraryEffects();
            newLibraryEffects.id = colladaReader.GetAttribute("id");
            newLibraryEffects.name = colladaReader.GetAttribute("name");

            newLibraryEffects.effect = new Collection<HMColladaEffect>();

            if (!colladaReader.IsEmptyElement) colladaReader.Read();
            do {
                if (colladaReader.NodeType != XmlNodeType.EndElement) {
                    switch (colladaReader.Name) {
                        case "effect": newLibraryEffects.effect.Add(LoadEffect()); break;
                    }
                }

                if (!colladaReader.IsEmptyElement) colladaReader.Read();
            } while (colladaReader.Name != "library_effects");

            if (colladaReader.IsEmptyElement) colladaReader.Read();
            return newLibraryEffects;
        }
    }
}